﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLZJFurnitureSCM.WinForm
{
    public partial class UserControlNewProduct : UserControl
    {
        private string _productType = string.Empty;

        public string ProductType
        {
            get{return this._productType;}
        }

        private UserControlNewProduct()
        {
            InitializeComponent();
        }

        public UserControlNewProduct(string productType):this()
        {
            this._productType = productType;
        }

        public UserControlNewProduct(QLZJFurnitureSCM.Model.Product product)
        {

        }

        private void UserControlNewProduct_Load(object sender, EventArgs e)
        {
            this.txtType.Text = this._productType;
        }

        private void txtProductPricePurchase_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsNumber(e.KeyChar) && !Char.IsPunctuation(e.KeyChar) && !Char.IsControl(e.KeyChar))
                e.Handled = true;
            else if (Char.IsPunctuation(e.KeyChar))
            {
                if (e.KeyChar == '.')
                {
                    if (((TextBox)sender).Text.LastIndexOf('.') != -1)
                        e.Handled = true;
                }
                else
                    e.Handled = true;
            }
        }

    }
}
